package com.muyu.product.service.impl;

import java.util.List;

import com.muyu.common.core.utils.ObjUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import com.muyu.product.mapper.RuleAttrInfoMapper;
import com.muyu.product.domain.RuleAttrInfo;
import com.muyu.product.service.RuleAttrInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;

/**
 * 规格详情Service业务层处理
 *
 * @author DongZeLiang
 * @date 2024-02-27
 */
@Slf4j
@Service
public class RuleAttrInfoServiceImpl extends ServiceImpl<RuleAttrInfoMapper, RuleAttrInfo>  implements RuleAttrInfoService {

    /**
     * 查询规格详情列表
     *
     * @param ruleAttrInfo 规格详情
     * @return 规格详情
     */
    @Override
    public List<RuleAttrInfo> list(RuleAttrInfo ruleAttrInfo) {
        LambdaQueryWrapper<RuleAttrInfo> queryWrapper = new LambdaQueryWrapper<>();


        if (ObjUtils.notNull(ruleAttrInfo.getRuleId())){
            queryWrapper.eq(RuleAttrInfo::getRuleId, ruleAttrInfo.getRuleId());
        }

        if (ObjUtils.notNull(ruleAttrInfo.getName())){
            queryWrapper.like(RuleAttrInfo::getName, ruleAttrInfo.getName());
        }

        if (ObjUtils.notNull(ruleAttrInfo.getAttrValue())){
            queryWrapper.eq(RuleAttrInfo::getAttrValue, ruleAttrInfo.getAttrValue());
        }





        return list(queryWrapper);
    }
}
